<?php

namespace app\api\model;

use think\Model;

class Orders extends Model
{
    // 表名
    protected $name = 'orders';
    protected $autoWriteTimestamp = 'datetime';
    protected $createTime = 'order_time';
    protected $updateTime = false;

    protected $type = [
        'order_time' => 'datetime:Y-m-d H:i:s'
    ];

    public function users()
    {
        return $this->hasMany('app\common\model\User');
    }

    public function addressBooks()
    {
        return $this->hasMany('AddressBook');
    }

    public function details()
    {
        return $this->hasMany('OrderDetail','order_id');
    }
}
